home *** CD-ROM | disk | FTP | other *** search
/ PC World Interactive 1 / PC World Interactive 1 - Nisan 1997.iso / nostalji / bbs / music / sbbook.arj / SBBOOK / SOURCE / DRIVERS.TXT
Encoding:
Text File  |  1993-12-29  |  80.4 KB  |  1,964 lines

  1.              Programming the Sound Blaster Drivers Directly
  2.  
  3.     Creative Labs currently offers drivers that provide a level of
  4. abstraction between the hardware and the application. These drivers release
  5. the programmer from the hassles of controlling the hardware directly while
  6. still providing all the services necessary for basic playback and recording
  7. of digital voice files (VOC), playback of music files (CMF and MID), and
  8. mixer control.
  9.  
  10.  
  11. ----------------------------------------------------------------------
  12. ------Programming the Digital Voice Memory Driver (CT-VOICE.DRV)------
  13. ----------------------------------------------------------------------
  14.     The CT-VOICE driver is a loadable driver rather than a TSR.  A loadable
  15. driver offers a better solution to the programmer because its loading and
  16. unloading is left to the application and not to the user. This increases the
  17. probability that the application using the driver will run the first time the
  18. user executes it.
  19.  
  20.  
  21. Loading the Driver
  22. ------------------
  23.         All functions in this digital voice driver are accessed as offsets
  24.     from the beginning of the segment where the driver was loaded. This
  25.     requires that the driver be loaded at a segment boundary. When a driver
  26.     is loaded at a segment boundary, it simply means that the starting
  27.     address of the driver must have an offset of zero (SEG:0000). If you are
  28.     using DOS function calls to allocate memory, then this has already been
  29.     done for you (interrupt 21h, function 48h). If you wish to use C's
  30.     malloc() or farmalloc() calls, then you need to follow the following
  31.     loading procedure.
  32.  
  33.     {
  34.         Get driver size.
  35.         Allocate memory for the driver size + 16.
  36.         Save the pointer returned by malloc for freeing the memory later.
  37.         Divide the pointer's offset by 16 and add it to the pointer's segment.
  38.         Add one to the pointer's segment.
  39.         Set the pointer's offset to zero.
  40.         Open the driver file.
  41.         Read the driver into the new location calculated above.
  42.         Close the driver file.
  43.                 .
  44.                 .
  45.                 .
  46.         Your program goes here.
  47.                 .
  48.                 .
  49.                 .
  50.         Free the memory associated with the original malloc'ed pointer.
  51.     }
  52.  
  53.  
  54. Digital Voice Playback from Conventional Memory
  55. -----------------------------------------------
  56.         The following pseudocode demonstrates voice playback from
  57.     conventional memory using Creative's new API, which is available on all
  58.     drivers with a version number of 3.00 or higher.
  59.  
  60.     {
  61.         Load CT-VOICE driver.
  62.         Get driver version by calling Get Parameter function with CX = 1.
  63.         If driver version is greater than or equal to version written for.
  64.         {
  65.             Call Get Environment Settings function.
  66.             Call Initialize Driver function.
  67.             Set the Voice Status Word by calling Set I/O Parameter function
  68.               with AX = 1.
  69.             Turn on the speaker by calling Set Speaker function with AX = 1.
  70.             Call Output from Conventional Memory function.
  71.                           .
  72.                           .
  73.                           .
  74.             Call Pause Voice Output function.
  75.             Call Continue Voice Output function.
  76.             Call Stop Voice I/O function.
  77.                           .
  78.                           .
  79.                           .
  80.             Monitor the Voice Status Word until finished (Voice Status
  81.               Word = 0000h).
  82.             Call Terminate Driver function.
  83.         }
  84.         Free memory used for the CT-VOICE driver.
  85.     }
  86.  
  87.  
  88. Digital Voice Recording from Conventional Memory
  89. ------------------------------------------------
  90.         The following pseudocode demonstrates voice recording to conventional
  91.     memory using Creative's new API, which is available on all drivers with
  92.     a version number of 3.00 or higher.
  93.  
  94.     {
  95.         Load CT-VOICE driver.
  96.         Get driver version by calling Get Parameter function with CX = 1.
  97.         If driver version is greater than or equal to version written for.
  98.         {
  99.             Call Get Environment Settings function.
  100.             Call Initialize Driver function.
  101.             Set the Voice Status Word by calling Set I/O Parameter
  102.               function with AX = 1.
  103.             Set the the number of channels to use by calling Set I/O
  104.               Parameter function with AX = 4.
  105.             Set the left channel's recording sources by calling Set I/O
  106.               Parameter function with AX = 5.
  107.             Set the right channel's recording sources by calling Set I/O
  108.               Parameter function with AX = 6.
  109.             Turn off the speaker by calling Set Speaker function with AX = 0.
  110.             Call Record into Conventional Memory function.
  111.             Create a VOC file header for recording.
  112.             Save recording to a file.
  113.             Call Stop Voice I/O function when finished.
  114.             Call Terminate Driver function.
  115.         }
  116.         Free memory used for the CT-VOICE driver.
  117.     }
  118.  
  119.  
  120. Digital Voice Playback from Extended Memory
  121. -------------------------------------------
  122.         The following pseudocode demonstrates voice playback from
  123.     extended memory using Creative's new API, which is available on all
  124.     drivers with a version number of 3.00 or higher.
  125.  
  126.     {
  127.         Load CT-VOICE driver.
  128.         Get driver version by calling Get Parameter function with CX = 1.
  129.         If driver version is greater than or equal to version written for.
  130.         {
  131.             Call Get Environment Settings function.
  132.             Check to see if HIMEM.SYS is loaded.
  133.             Allocate extended memory large enough to hold file.
  134.             Call Initialize Driver function.
  135.             Set the Voice Status Word by calling Set I/O Parameter function
  136.               with AX = 1.
  137.             Load file into extended memory.
  138.             Turn on the speaker by calling Set Speaker function with AX = 1.
  139.             Call Output from Extended Memory function.
  140.                           .
  141.                           .
  142.                           .
  143.             Call Pause Voice Output function.
  144.             Call Continue Voice Output function.
  145.             Call Stop Voice I/O function.
  146.                           .
  147.                           .
  148.                           .
  149.             Monitor the Voice Status Word until finished (Voice Status
  150.               Word = 0000h).
  151.             Call Terminate Driver function.
  152.             Free extended memory.
  153.         }
  154.         Free memory used for the CT-VOICE driver.
  155.     }
  156.  
  157.  
  158. Digital Voice Recording from Extended Memory
  159. --------------------------------------------
  160.         The following pseudocode demonstrates voice recording to extended
  161.     memory using Creative's new API, which is available on all drivers
  162.     with a version number of 3.00 or higher.
  163.  
  164.     {
  165.         Load CT-VOICE driver.
  166.         Get driver version by calling Get Parameter function with CX = 1.
  167.         If driver version is greater than or equal to version written for.
  168.         {
  169.             Call Get Environment Settings function.
  170.             Check to see if HIMEM.SYS is loaded.
  171.             Allocate extended memory buffer for recording into.
  172.             Call Initialize Driver function.
  173.             Set the Voice Status Word by calling Set I/O Parameter function
  174.               with AX = 1.
  175.             Set the the number of channels to use by calling Set I/O
  176.               Parameter function with AX = 4.
  177.             Set the left channel's recording sources by calling Set I/O
  178.               Parameter function with AX = 5.
  179.             Set the right channel's recording sources by calling Set I/O
  180.               Parameter function with AX = 6.
  181.             Turn off the speaker by calling Set Speaker function with AX = 0.
  182.             Call Record into Extended Memory function.
  183.             Call Stop Voice I/O function when finished.
  184.             Call Terminate Driver function.
  185.             Create a VOC file header for recording.
  186.             Save recording to a file.
  187.             Free extended memory buffer.
  188.         }
  189.         Free memory used for the CT-VOICE driver.
  190.     }
  191.  
  192.  
  193. CT-VOICE Function Definitions
  194. -----------------------------
  195.         The following pseudocode demonstrates mixer functions using
  196.     Creative's new API, which is available on all drivers with a version
  197.     number of 3.00 or higher.
  198.  
  199.     < Parameters Used with Set Parameters Function >
  200.  
  201.         Parameter Number  Description
  202.         -------------------------------
  203.               1           Voice status word address
  204.               3           Sampling rate
  205.               4           Number of channels to use for recording
  206.               5           Left channel sources for recording
  207.               6           Right channel sources for recording
  208.               7           Voice format for recording*
  209.               8           Bits per sample for recording
  210.  
  211.     < Parameters Used with Get and Set I/O Parameters Functions >
  212.  
  213.         Parameter Number  Description
  214.         -------------------------------
  215.               1           Driver version
  216.               2           Card type number
  217.               3           Card name
  218.               4           Number of input channels
  219.               5           Number of output channels
  220.               6           Driver size, less embedded DMA buffer*
  221.               7           Number of I/O handles supported
  222.               8           Driver build number
  223.               9           Size of embedded DMA buffer
  224.               10          Sampling rate limits
  225.  
  226.         * The CT-VOICE and CTVDSK drivers now use auto-init mode,
  227.         which offers higher quality audio reproduction. Auto-init mode
  228.         requires a DMA buffer to record and play back digital data. To
  229.         support code written for earlier drivers, a DMA buffer had to be
  230.         embedded in the driver. If you wish to provide the driver with
  231.         your own DMA buffer, then you can use this value to determine how
  232.         much of the driver to read into memory, thus removing the DMA
  233.         buffer.
  234.  
  235.     < Input Sources Used with Get and Set I/O Parameter Functions >
  236.                           parameters 5 and 6
  237.  
  238.         The input sources allow you to select the recording sources
  239.         for the left and right channels. Each channel is defined by one
  240.         word (2 bytes). Source selection is defined as follows:
  241.  
  242.         D15...D8   D7   D6   D5   D4   D3   D2   D1   D0
  243.          |....|    |    |    |    |    |    |    |    |
  244.          |....|    |    |    |    |    |    |    |    +---> Microphone
  245.          |....|    |    |    |    |    |    |    +--------> Microphone
  246.          |....|    |    |    |    |    |    +-------------> CD Right
  247.          |....|    |    |    |    |    +------------------> CD Left
  248.          |....|    |    |    |    +-----------------------> Line-In Right
  249.          |....|    |    |    +----------------------------> Line-In Left
  250.          |....|    |    +---------------------------------> MIDI Right
  251.          |....|    +--------------------------------------> MIDI Left
  252.          |....|
  253.          |....+-------------------------------------------> Not Used
  254.          +------------------------------------------------> Not Used
  255.  
  256.         Note: Since the microphone is a mono source, both bits (D0 and D1)
  257.               should be set.  When using the Sound Blaster Pro, only the
  258.               Line-In, CD, and Microphone are applicable. Also, only one
  259.               source may be used, and both channels of that source should
  260.               be selected simultaneously.
  261.  
  262.  
  263. File Formats Used with Get and Set I/O Parameters Functions
  264. -----------------------------------------------------------
  265.         Only PCM file format (function 0) is supported in this text.
  266.     Compression and decompression information is available in the DOS
  267.     developers kit by Creative Labs.
  268.  
  269.  
  270. Driver Error Codes
  271. ------------------
  272.     Error Code  Description
  273.         1       DOS memory allocation error
  274.         2       Another voice I/O process is currently active
  275.         3       DOS read voice file error
  276.         4       DOS write voice file error
  277.         5       DOS lseek error on voice file
  278.         6       Disk full
  279.         7       Invalid voice file format
  280.         8       Disk buffer is not allocated
  281.         9       DOS open voice file error
  282.         10      Sound card I/O error
  283.         11      Incorrect driver version
  284.         12      IRQ error
  285.         13      Not a Sound Blaster Card
  286.         14      Creative DSP copyright message error
  287.         15      DMA buffer is not allocated
  288.         16      8-bit DMA error
  289.         17      16-bit DMA error
  290.         18      Invalid I/O handle
  291.  
  292.  
  293. DOS Error Codes
  294. ---------------
  295.         Refer to the DOS Technical Reference manual for the error
  296.     code descriptions.
  297.  
  298.  
  299. Function definitions
  300. --------------------
  301. *   Initialize Driver (function 3) - This function initializes the driver
  302.                                       and the sound card.
  303.  
  304.         Entry:  The registers should be set as follows for entry to the
  305.                 driver:
  306.  
  307.                 BX = 3 - function number (Initialize Driver)
  308.  
  309.         Exit:   Upon exit from the driver, the following values will be
  310.                 returned in the registers listed:
  311.  
  312.                 AX = error code - Zero if successful. Nonzero if function
  313.                      failed.
  314.  
  315.  
  316. *   Set Speaker (function 4) - This function turns the DAC speaker ON or OFF.
  317.  
  318.         Entry:  The registers should be set as follows for entry to the
  319.                 driver:
  320.  
  321.                 BX = 4 - function number (Set Speaker)
  322.                 AX = 0 - OFF, 1 - ON
  323.  
  324.         Exit:   No values are returned by the driver upon exit.
  325.  
  326.  
  327. *   Terminate Driver (function 9) - This function performs some necessary
  328.                                     housekeeping before the application is
  329.                                     exited.
  330.  
  331.         Entry:  The registers should be set as follows for entry to the
  332.                 driver:
  333.  
  334.                 BX = 9 - function number (Terminate Driver)
  335.  
  336.         Exit:   No values are returned by the driver upon exit.
  337.  
  338.  
  339. *   Get Environment Settings (function 28) - This function parses the
  340.                                              BLASTER environment string and
  341.                                              sets the base I/O address, the
  342.                                              interrupt number, and the DMA
  343.                                              channel in the driver.
  344.  
  345.         Entry:  The registers should be set as follows for entry to the
  346.                 driver:
  347.  
  348.                 BX = 28 - function number (Get Environment Settings)
  349.                 ES:DI = far pointer to the BLASTER environment string
  350.  
  351.         Exit:   Upon exit from the driver, the following values will be
  352.                 returned in the registers listed:
  353.  
  354.                 AX = error code - Zero if successful. Nonzero if function
  355.                      failed.
  356.  
  357.  
  358. *   Get Parameter (function 29) - This function returns information
  359.                                   pertaining to the driver and the sound
  360.                                   card.
  361.  
  362.         Entry:  The registers should be set as follows for entry to the
  363.                 driver:
  364.  
  365.                 BX = 29 - function number (Get Parameter)
  366.                 CX = parameter
  367.                 DX:AX = far pointer to parameter's value
  368.  
  369.         Exit:   Upon exit from the driver, the following values will be
  370.                 returned in the registers listed:
  371.  
  372.                 AX = error code - Zero if successful. Nonzero if function
  373.                      failed.
  374.  
  375.  
  376. *   Set DMA Buffer (function 30) - This function allows the user the
  377.                                    flexibility of providing the DMA buffer
  378.                 for the driver. The buffer passed to the driver must not
  379.                 straddle a physical page (64K) boundary. A physical page
  380.                 boundary can be defined as the point in memory where the
  381.                 most significant digit in the segment changes
  382.                 (in other words, 1FFF:FFFF => 2000:0000).  You should also
  383.                 allocate an extra 16 bytes above the DMA buffer size desired
  384.                 so that the driver can round up to the next page boundary.
  385.                 A page boundary can be defined as the point where the lowest
  386.                 digit in the offset is zero (in other words, 1FFF:FFF0).
  387.  
  388.         Entry:  The registers should be set as follows for entry to the
  389.                 driver:
  390.  
  391.                 BX = 30 - function number (Set DMA Buffer)
  392.                 AX = I/O handle (0 for first file, 1 for second, ...)
  393.                 ES:DI = far pointer to buffer
  394.                 CX = 1/2 buffer size in Kbytes (for example, 32-Kbyte
  395.                      buffer = 16)
  396.  
  397.         Exit:   Upon exit from the driver, the following values will be
  398.                 returned in the registers listed:
  399.  
  400.                 AX = error code - Zero if successful. Nonzero if function
  401.                      failed.
  402.  
  403.  
  404. *   Set I/O Parameter (function 31) - This function is a generic function
  405.                                       for setting various parameters in the
  406.                                       driver. The parameters that may be
  407.                                       changed are detailed in the section,
  408.                                       "CT-VOICE Function Definitions",
  409.                                       earlier in this chapter.
  410.  
  411.         Entry:  The registers should be set as follows for entry to the
  412.                 driver:
  413.  
  414.                 BX = 31 - function number (Set I/O Parameter)
  415.                 AX = I/O handle (0 for first file, 1 for second, ...)
  416.                 DX = parameter type (see "CT-VOICE Function Definitions")
  417.                 DI:SI = parameter value
  418.  
  419.         Exit:   Upon exit from the driver, the following values will be
  420.                 returned in the registers listed:
  421.  
  422.                 AX = error code - Zero if successful. Nonzero if function
  423.                      failed.
  424.  
  425.  
  426. *   Get I/O Parameter (function 32) - This function is a generic function
  427.                                       for getting various parameters in the
  428.                                       driver. The parameters that may be
  429.                                       changed are detailed in "CT-VOICE
  430.                                       Function Definitions."
  431.  
  432.         Entry:  The registers should be set as follows for entry to the
  433.                 driver:
  434.  
  435.                 BX = 32 - function number (Get I/O Parameter)
  436.                 AX = I/O handle (0 for first file, 1 for second, ...)
  437.                 DX = parameter type (see "CT-VOICE Function Definitions")
  438.                 ES:DI = far pointer to parameter storage
  439.  
  440.         Exit:   Upon exit from the driver, the following values will be
  441.                 returned in the registers listed:
  442.  
  443.                 AX = error code - Zero if successful. Nonzero if function
  444.                      failed.
  445.  
  446.  
  447. *   Input Into Conventional Memory (function 33) - This function starts
  448.                                                    voice recording into
  449.                                                    conventional memory.
  450.  
  451.         Entry:  The registers should be set as follows for entry to the
  452.                 driver:
  453.  
  454.                 BX = 33 - function number (Input into Conventional Memory)
  455.                 AX = I/O handle (0 for first file, 1 for second, ...)
  456.                 ES:DI = far pointer to conventional memory buffer
  457.                 DX:CX = buffer size
  458.  
  459.         Exit:   Upon exit from the driver, the following values will be
  460.                 returned in the registers listed:
  461.  
  462.                 AX = error code - Zero if successful. Nonzero if function
  463.                      failed.
  464.  
  465.  
  466. *   Input Into Extended Memory (function 34) - This function starts voice
  467.                                                recording into extended memory.
  468.  
  469.         Entry:  The registers should be set as follows for entry to the
  470.                 driver:
  471.  
  472.                 BX = 34 - function number (Input into Extended Memory)
  473.                 AX = I/O handle (0 for first file, 1 for second, ...)
  474.                 DX = XMS handle
  475.                 DI:SI = offset into XMS block where data is located
  476.                 CX = XMS block size in Kbytes
  477.  
  478.         Exit:   Upon exit from the driver, the following values will be
  479.                 returned in the registers listed:
  480.  
  481.                 AX = error code - Zero if successful. Nonzero if function
  482.                      failed.
  483.  
  484.  
  485. *   Output from Conventional Memory (function 35) - This function starts
  486.                                                     voice playback from
  487.                                                     conventional memory.
  488.  
  489.         Entry:  The registers should be set as follows for entry to the
  490.                 driver:
  491.  
  492.                 BX = 35 - function number (Output from Conventional Memory)
  493.                 AX = I/O handle (0 for first file, 1 for second, ...)
  494.                 ES:DI = far pointer to conventional memory buffer
  495.  
  496.         Exit:   Upon exit from the driver, the following values will be
  497.                 returned in the registers listed:
  498.  
  499.                 AX = error code - Zero if successful. Nonzero if function
  500.                      failed.
  501.  
  502.  
  503. *   Output from Extended Memory (function 36) - This function starts voice
  504.                                                 playback from extended memory.
  505.  
  506.         Entry:  The registers should be set as follows for entry to the
  507.                 driver:
  508.  
  509.                 BX = 36 - function number (Output from Extended Memory)
  510.                 AX = I/O handle (0 for first file, 1 for second, ...)
  511.                 DX = XMS handle
  512.                 DI:SI = offset into XMS block where data is located
  513.  
  514.         Exit:   Upon exit from the driver, the following values will be
  515.                 returned in the registers listed:
  516.  
  517.                 AX = error code - Zero if successful. Nonzero if function
  518.                      failed.
  519.  
  520.  
  521. *   Stop Voice I/O (function 37) - This function halts playback or recording.
  522.  
  523.         Entry:  The registers should be set as follows for entry to the
  524.                 driver:
  525.  
  526.                 BX = 37 - function number (Stop Voice I/O)
  527.                 AX = I/O handle (0 for first file, 1 for second, ...)
  528.  
  529.         Exit:   Upon exit from the driver, the following values will be
  530.                 returned in the registers listed:
  531.  
  532.                 AX = error code - Zero if successful. Nonzero if function
  533.                      failed.
  534.  
  535.  
  536. *   Pause Voice Output (function 38) - This function pauses playback.
  537.  
  538.         Entry:  The registers should be set as follows for entry to the
  539.                 driver:
  540.  
  541.                 BX = 38 - function number (Stop Voice I/O)
  542.                 AX = I/O handle (0 for first file, 1 for second, ...)
  543.  
  544.         Exit:   Upon exit from the driver, the following values will be
  545.                 returned in the registers listed:
  546.  
  547.                 AX = error code - Zero if successful. Nonzero if function
  548.                      failed.
  549.  
  550.  
  551. *   Continue Voice Output (function 39) - This function resumes currently
  552.                                           paused playback.
  553.  
  554.         Entry:  The registers should be set as follows for entry to the
  555.                 driver:
  556.  
  557.                 BX = 39 - function number (Continue Voice Output)
  558.                 AX = I/O handle (0 for first file, 1 for second, ...)
  559.  
  560.         Exit:   Upon exit from the driver, the following values will be
  561.                 returned in the registers listed:
  562.  
  563.                 AX = error code - Zero if successful. Nonzero if function
  564.                      failed.
  565.  
  566.  
  567. *   Break Voice Output Loop (function 40) - This function breaks out of a
  568.                                             currently repeating loop of data
  569.                                             and continues with the playback
  570.                                             after the loop.
  571.  
  572.         Entry:  The registers should be set as follows for entry to the
  573.                 driver:
  574.  
  575.                 BX = 40 - function number (Break Voice Output Loop)
  576.                 AX = I/O handle (0 for first file, 1 for second, ...)
  577.                 CX = 0       - complete currently looping sample,
  578.                      nonzero - exit loop immediately.
  579.  
  580.         Exit    Upon exit from the driver, the following values will be
  581.                 returned in the registers listed:
  582.  
  583.                 AX = error code - Zero if successful. Nonzero if function
  584.                      failed.
  585.  
  586.  
  587. -----------------------------------------------------------------------
  588. ------Programming the Digital Voice from Disk Driver (CTVDSK.DRV)------
  589. -----------------------------------------------------------------------
  590.     The CTVDSK driver is a loadable driver instead of a TSR. A loadable
  591. driver offers a better solution to the programmer, because its loading and
  592. unloading is left to the application and not to the user. This increases the
  593. probability that the application using the driver will run the first time the
  594. user executes it.
  595.  
  596.  
  597. Loading the Driver
  598. ------------------
  599.         All functions in this digital voice driver are accessed as offsets
  600.     from the beginning of the segment where the driver was loaded. This
  601.     requires that the driver be loaded at a segment boundary. Loading a
  602.     driver at a segment boundary simply means that the starting address of
  603.     the driver must have an offset of zero (SEG:0000). If you are using DOS
  604.     function calls to allocate memory, then this has already been done for
  605.     you (Interrupt 21h, function 48h). If you wish to use C's malloc() or
  606.     farmalloc() calls then you need to follow the following loading procedure.
  607.  
  608.     {
  609.         Get driver size
  610.         Allocate memory for the driver size + 16
  611.         Save the pointer returned by malloc for freeing the memory later
  612.         Divide the pointer's offset by 16 and add it to the pointer's segment
  613.         Add one to the pointer's segment
  614.         Set the pointer's offset to zero
  615.         Open the driver file
  616.         Read the driver into the new location calculated above
  617.         Close the driver file
  618.                 .
  619.                 .
  620.                 .
  621.         Your program goes here
  622.                 .
  623.                 .
  624.                 .
  625.         Free the memory associated with the original malloc'ed pointer
  626.     }
  627.  
  628.  
  629. Digital Voice Playback from Disk
  630. --------------------------------
  631.         The following pseudocode demonstrates voice playback from disk using
  632.     Creative's new API, which is available on all drivers with a version
  633.     number of 3.00 or higher.
  634.  
  635.     {
  636.         Load CTVDSK driver
  637.         Get driver version by calling Get Parameter function with CX = 1
  638.         If driver version is greater than or equal to version written for
  639.         {
  640.             Call Get Environment Settings function
  641.             Call Initialize Driver function
  642.             Allocate memory for intermediate disk buffer
  643.             Call Set Disk Buffer function
  644.             Set the Voice Status Word by calling Set I/O Parameter
  645.               function with CX = 1
  646.             Call Output function
  647.                           .
  648.                           .
  649.                           .
  650.             Call Pause Voice Output function
  651.             Call Continue Voice Output function
  652.             Call Stop Voice I/O function
  653.                           .
  654.                           .
  655.                           .
  656.             Call Get Error Codes function to determine if all went well
  657.             Call Terminate Driver function
  658.         }
  659.         Free memory used for the CTVDSK driver.
  660.     }
  661.  
  662.  
  663. Digital Voice Recording to Disk
  664. -------------------------------
  665.         The following pseudocode demonstrates voice recording using
  666.     Creative's new API, which is available on all drivers with a version
  667.     number of 3.00 or higher.
  668.  
  669.     {
  670.         Load CTVDSK driver
  671.         Get driver version by calling Get Parameter function with CX = 1
  672.         If driver version is greater than or equal to version written for
  673.         {
  674.             Call Get Environment Settings function
  675.             Call Initialize Driver function
  676.             Allocate memory for intermediate disk buffer
  677.             Call Set Disk Buffer function
  678.             Turn off speaker by calling Set Speaker function with AX = 0
  679.             Set the Voice Status Word by calling Set I/O Parameter
  680.               function with CX = 1
  681.             Set the Number of Channels by calling Set I/O Parameter
  682.               function with CX = 4
  683.             Set the data format type by calling Set I/O Parameter
  684.               function with CX = 7
  685.             Set the bits per sample by calling Set I/O Parameter function
  686.               with CX = 8
  687.             Set the sample rate by calling Set I/O Parameter function
  688.               with CX = 3
  689.             Set the left input sources by calling Set I/O Parameter
  690.               function with CX = 5
  691.             Set the right input sources by calling Set I/O Parameter
  692.               function with CX = 6
  693.             Call Input function
  694.                           .
  695.                           .
  696.                           .
  697.             Call Stop Voice I/O function
  698.             Call Get Error Codes function to determine if all is well
  699.             Call Terminate Driver function
  700.         }
  701.         Free memory used for the CTVDSK driver.
  702.     }
  703.  
  704.  
  705. CTVDSK Function Definitions
  706. ---------------------------
  707.         These functions should not be mixed with the API calls available
  708.     before driver version 3.00. For parameter definitions please refer to
  709.     the section, "CT-VOICE Function Definitions".
  710.  
  711. *   Set Speaker - This function turns the DAC speaker ON or OFF.
  712.  
  713.         Entry:  The registers should be set as follows for entry to the
  714.                 driver:
  715.  
  716.                 BX = 4 - function number (Set Speaker)
  717.                 AX = 0 - OFF, 1 - ON
  718.  
  719.         Exit:   No values are returned by the driver upon exit.
  720.  
  721.  
  722. *   Terminate Driver (function 9) _ This function performs some necessary
  723.                                     housekeeping before the application is
  724.                                     exited.
  725.  
  726.         Entry:  The registers should be set as follows for entry to the
  727.                 driver:
  728.  
  729.                 BX = 9 - function number (Terminate Driver)
  730.  
  731.         Exit:   No values are returned by the driver upon exit.
  732.  
  733.  
  734. *   Get Error Codes (function 14) - This function returns any errors that
  735.                                     may have occurred during the driver's
  736.                                     recent operation.
  737.  
  738.         Entry:  The registers should be set as follows for entry to the
  739.                 driver:
  740.  
  741.                 BX = 14 - function number (Get Error Codes)
  742.  
  743.         Exit:   Upon exit from the driver, the following values will be
  744.                 returned in the registers listed:
  745.  
  746.                 AX = driver error code
  747.                 DX = DOS error code
  748.  
  749.  
  750. *   Get Environment Settings (function 26) - This function parses the
  751.                                              BLASTER environment string and
  752.                                              sets the base I/O address, the
  753.                                              interrupt number, and the DMA
  754.                                              channel in the driver.
  755.  
  756.         Entry:  The registers should be set as follows for entry to the
  757.                 driver:
  758.  
  759.                 BX = 26 - function number (Get Environment Settings)
  760.                 ES:DI = far pointer to the BLASTER environment string
  761.  
  762.         Exit:   Upon exit from the driver, the following values will be
  763.                 returned in the registers listed:
  764.  
  765.                 AX = error code - Zero if successful. Nonzero if function
  766.                      failed.
  767.  
  768.  
  769. *   Get Parameter (function 27) - This function returns information pertaining
  770.                                   to the driver and the sound card.
  771.  
  772.         Entry:  The registers should be set as follows for entry to the
  773.                 driver:
  774.  
  775.                 BX = 27 - function number (Get Parameter)
  776.                 CX = parameter
  777.                 DX:AX = far pointer to parameter's value
  778.  
  779.         Exit:   Upon exit from the driver, the following values will be
  780.                 returned in the registers listed:
  781.  
  782.                 AX = error code - Zero if successful. Nonzero if function
  783.                      failed.
  784.  
  785.  
  786. *   Set Disk Buffer (function 28) - This function sets up an intermediate
  787.                                     buffer for direct-to-disk playback and
  788.                                     recording. It is not used for memory
  789.                                     playback and recording.
  790.  
  791.         Entry:  The registers should be set as follows for entry to the
  792.                 driver:
  793.  
  794.                 BX = 28 - function number (Set Disk Buffer)
  795.                 SI = I/O handle (0 for first file, 1 for second, ...)
  796.                 DX:AX = far pointer to buffer
  797.                 CX = 1/2 buffer size in Kbytes (for example, 32-Kbyte
  798.                      buffer = 16).
  799.  
  800.         Exit:   Upon exit from the driver, the following values will be
  801.                 returned in the registers listed:
  802.  
  803.                 AX = error code - Zero if successful. Nonzero if function
  804.                      failed.
  805.  
  806.  
  807. *   Set DMA Buffer (function 29) - This function allows the user the
  808.                                    flexibility of providing the DMA buffer
  809.                 for the driver. The buffer passed to the driver must not
  810.                 straddle a physical page (64K) boundary. A physical page
  811.                 boundary can be defined as the point in memory where the
  812.                 most significant digit in the segment changes
  813.                 (for example, 1FFF:FFFF => 2000:0000). You should also
  814.                 allocate an extra 16 bytes  above the DMA buffer size
  815.                 desired so that the driver can round up to the next page
  816.                 boundary. A page boundary can be defined as the point
  817.                 where the lowest digit in the offset is zero
  818.                 (for example, 1FFF:FFF0).
  819.  
  820.         Entry:  The registers should be set as follows for entry to the
  821.                 driver:
  822.  
  823.                 BX = 29 - function number (Set DMA Buffer)
  824.                 SI = I/O handle (0 for first file, 1 for second, ...)
  825.                 DX:AX = far pointer to buffer
  826.                 CX = 1/2 buffer size in Kbytes (for example, 32-Kbyte
  827.                      buffer = 16).
  828.  
  829.         Exit:   Upon exit from the driver, the following values will be
  830.                 returned in the registers listed:
  831.  
  832.                 AX = error code - Zero if successful. Nonzero if function
  833.                      failed.
  834.  
  835. *   Set I/O Parameter (function 30) - This function is a generic function
  836.                                       for setting various parameters in the
  837.                                       driver. The parameters that may be
  838.                                       changed are detailed in the section,
  839.                                       "CT-VOICE Function Definitions,"
  840.                                       earlier in this chapter."
  841.  
  842.         Entry:  The registers should be set as follows for entry to the
  843.                 driver:
  844.  
  845.                 BX = 30 - function number (Set I/O Parameter)
  846.                 SI = I/O handle (0 for first file, 1 for second, ...)
  847.                 CX = parameter type (see "CT-VOICE Function Definitions")
  848.                 DX:AX = parameter value
  849.  
  850.         Exit:   Upon exit from the driver, the following values will be
  851.                 returned in the registers listed:
  852.  
  853.                 AX = error code - Zero if successful. Nonzero if function
  854.                      failed.
  855.  
  856.  
  857. *   Get I/O Parameter (function 31) - This function is a generic function
  858.                                       for getting various parameters in the
  859.                                       driver. The parameters that may be
  860.                                       changed are detailed in the section
  861.                                       "CT-VOICE Function Definitions".
  862.  
  863.         Entry:  The registers should be set as follows for entry to the
  864.                 driver:
  865.  
  866.                 BX = 31 - function number (Get I/O Parameter)
  867.                 SI = I/O handle (0 for first file, 1 for second, ...)
  868.                 CX = parameter type (see "CT-VOICE Function Definitions")
  869.                 DX:AX = far pointer to parameter storage
  870.  
  871.         Exit:   Upon exit from the driver, the following values will be
  872.                 returned in the registers listed:
  873.  
  874.                 AX = error code - Zero if successful. Nonzero if function
  875.                      failed.
  876.  
  877.  
  878. *   Input (function 32) - This function starts the voice recording to the
  879.                           disk.
  880.  
  881.         Entry:  The registers should be set as follows for entry to the
  882.                 driver:
  883.  
  884.                 BX = 32 - function number (Input)
  885.                 DX = I/O handle (0 for first file, 1 for second, ...)
  886.                 AX = file handle of VOC file to record to
  887.  
  888.         Exit:   Upon exit from the driver, the following values will be
  889.                 returned in the registers listed:
  890.  
  891.                 AX = error code - Zero if successful. Nonzero if function
  892.                      failed.
  893.  
  894.  
  895. *   Output (function 33) - This function starts the voice playback from the
  896.                            disk.
  897.  
  898.         Entry:  The registers should be set as follows for entry to the
  899.                 driver:
  900.  
  901.                 BX = 33 - function number (Output)
  902.                 DX = I/O handle (0 for first file, 1 for second, ...)
  903.                 AX = file handle of VOC file to play
  904.  
  905.         Exit:   Upon exit from the driver, the following values will be
  906.                 returned in the registers listed:
  907.  
  908.                 AX = error code - Zero if successful. Nonzero if function
  909.                      failed.
  910.  
  911.  
  912. *   Stop Voice I/O (function 34) - This function halts playback or recording.
  913.  
  914.         Entry:  The registers should be set as follows for entry to the
  915.                 driver:
  916.  
  917.                 BX = 34 - function number (Stop Voice I/O)
  918.                 DX = I/O handle (0 for first file, 1 for second, ...)
  919.  
  920.         Exit:   Upon exit from the driver, the following values will be
  921.                 returned in the registers listed:
  922.  
  923.                 AX = error code - Zero if successful. Nonzero if function
  924.                      failed.
  925.  
  926.  
  927. *   Pause Voice Output (function 35) - This function pauses playback.
  928.  
  929.         Entry:  The registers should be set as follows for
  930.                 entry to the driver:
  931.  
  932.                 BX = 35 - function number (Stop Voice I/O)
  933.                 DX = I/O handle (0 for first file, 1 for second, ...)
  934.  
  935.         Exit:   Upon exit from the driver, the following values will be
  936.                 returned in the registers listed:
  937.  
  938.                 AX = error code - Zero if successful. Nonzero if function
  939.                      failed.
  940.  
  941.  
  942. *   Continue Voice Output (function 36) - This function resumes currently
  943.                                           paused playback.
  944.  
  945.         Entry:  The registers should be set as follows for entry to the
  946.                 driver:
  947.  
  948.                 BX = 36 - function number (Continue Voice Output)
  949.                 DX = I/O handle (0 for first file, 1 for second, ...)
  950.  
  951.         Exit:   Upon exit from the driver, the following values will be
  952.                 returned in the registers listed:
  953.  
  954.                 AX = error code - Zero if successful. Nonzero if function
  955.                      failed.
  956.  
  957.  
  958. *   Break Voice Output Loop (function 37) - This function breaks out of a
  959.                                             currently repeating loop of data
  960.                                             and continues with the playback
  961.                                             after the loop.
  962.  
  963.         Entry:  The registers should be set as follows for entry to the
  964.                 driver:
  965.  
  966.                 BX = 37 - function number (Break Voice Output Loop)
  967.                 DX = I/O handle (0 for first file, 1 for second, ...)
  968.                 AX = 0 - complete currently looping sample, nonzero - exit
  969.                          loop immediately.
  970.  
  971.         Exit:   Upon exit from the driver, the following values will be
  972.                 returned in the registers listed:
  973.  
  974.                 AX = error code - Zero if successful. Nonzero if function
  975.                      failed.
  976.  
  977.  
  978. *   Initialize Driver (function 38) - This function initializes the driver
  979.                                       and the sound card.
  980.  
  981.         Entry:  The registers should be set as follows for entry to the
  982.                 driver:
  983.  
  984.                 BX = 38 - function number (Initialize Driver)
  985.  
  986.         Exit:   Upon exit from the driver, the following values will be
  987.                 returned in the registers listed:
  988.  
  989.                 AX = error code - Zero if successful. Nonzero if function
  990.                      failed.
  991.  
  992.  
  993. ---------------------------------------------------------
  994. ------Programming the FM Music Driver (SBFMDRV.COM)------
  995. ---------------------------------------------------------
  996.     SBFMDRV is a TSR driver that will play CMF files on the board's FM
  997. synthesizer chip(s) if you own an SB16. To use the driver you must first
  998. install it into memory, determine what interrupt it was attached to, and
  999. make all calls to the driver via that interrupt.
  1000.  
  1001. Locating SBFMDRV
  1002. ----------------
  1003.         The SBFMDRV functions are invoked by calling the interrupt that was
  1004.     defined when the TSR was loaded. When loading, SBFMDRV will scan
  1005.     interrupts between 80h and BFh, choosing the first unused interrupt
  1006.     (0000:0000). SBFMDRV can be identified by searching for the signature
  1007.     string "SBFMDRV" located at offset 103h from the interrupt vector's
  1008.     segment (ISEG:0103h).
  1009.  
  1010.     This pseudocode illustrates how to locate SBFMDRV:
  1011.  
  1012.     while not last interrupt and SBFMDRV not found
  1013.     {
  1014.         get interrupt vector
  1015.         signature pointer = (interrupt vector's segment : 0103h)
  1016.         does signature = "SBFMDRV"?
  1017.             SBFMDRV = found
  1018.         else
  1019.             increment to next interrupt
  1020.     }
  1021.  
  1022.      Note: Function FindDvr() in file DRVRFUNC.C demonstrates this concept.
  1023.  
  1024.  
  1025. Playing a CMF File
  1026. ------------------
  1027.     This pseudo code illustrates how to play a .CMF file.
  1028.  
  1029.     If SBFMDRV's entry interrupt is located
  1030.     {
  1031.         Call Get Driver Version
  1032.         If driver version is greater than or equal to version written for
  1033.         {
  1034.             Call Initialize SBFMDRV Driver
  1035.             Call Set Status Byte
  1036.             Call Reset FM Driver
  1037.             Load FM music file into music buffer
  1038.             Locate Instrument Table in file header (Use offset 06 - 07 of CMF
  1039.               file to locate)
  1040.             Call Set Instrument Table
  1041.             Calculate the clock rate for the driver (Use offset 0Ch - 0Dh of
  1042.               the CMF file)
  1043.             Call Set Music Clock Rate
  1044.             Call Play FM Music
  1045.             If no errors from Play FM Music function
  1046.             {
  1047.                          .
  1048.                          .
  1049.                          .
  1050.                 Call Pause FM Music
  1051.                 Call Resume FM Music
  1052.                          .
  1053.                          .
  1054.                          .
  1055.                 Call Stop FM Music
  1056.             }
  1057.             Call Reset FM Driver
  1058.         }
  1059.     }
  1060.  
  1061.  
  1062. SBFMDRV Function Definitions
  1063. ----------------------------
  1064.         The SBFMDRV driver is accessed via the INT call.  All parameters are
  1065.     exchanged with the driver through registers. In general, the BX register
  1066.     contains the function number to invoke.  The return value may be found
  1067.     in the AX register if it is a byte or word or in DX:AX if it is a double
  1068.     word (4 bytes).  Current status of the driver may be determined by
  1069.     reading the Status Byte (see "Set Status Address").
  1070.  
  1071.         Status Byte = 00h   Music is not playing
  1072.         Status Byte = FFh   Music is playing
  1073.  
  1074.         Except for the AX and DX, all registers are preserved  including the
  1075.     CPU flag register.
  1076.  
  1077.  
  1078. *   Get Driver Version (0) - This function returns the driver's version
  1079.                              number.
  1080.  
  1081.         Entry:  The registers should be set as follows for entry to the
  1082.                 driver:
  1083.  
  1084.                 BX = 0 - function number (Get Driver Version)
  1085.  
  1086.         Exit:   Upon exit from the driver, the following values will be
  1087.                 returned in the registers listed:
  1088.  
  1089.                 AH = Major version number
  1090.                 AL = Minor version number
  1091.  
  1092.  
  1093. *   Set Status Address (function 1) - This function provides SBFMDRV with a
  1094.                                       variable to report the current status
  1095.                                       of the driver. Your application must
  1096.                                       set this value before preparing a CMF
  1097.                                       file for playback.
  1098.  
  1099.         Entry:  The registers should be set as follows for entry to the
  1100.                 driver:
  1101.  
  1102.                 BX = 1 - function number (Set Status Address)
  1103.                 DX:AX - far pointer to the MIDI status byte
  1104.  
  1105.         Exit:   No values are returned by the driver upon exit.
  1106.  
  1107.  
  1108. *   Set Instrument Table (2) - This function provides the driver with the
  1109.                                parameters necessary to program the FM chip(s)
  1110.                 for the instruments used in the CMF file(s) provided to the
  1111.                 driver.  If the number of instruments defined in this table
  1112.                 is less than the number of available music channels, then
  1113.                 the driver reuses the instruments from the start of the table
  1114.                 until all channels are used.  The maximum number of
  1115.                 instruments that may be defined in this table is 128. If no
  1116.                 table is passed to the driver, a default group of 16
  1117.                 instruments is used.  To play the CMF file correctly, you
  1118.                 should pass the driver a pointer to the file's instrument
  1119.                 table. This pointer may be found at offsets 06 - 07 in the
  1120.                 file's header.  For a definition of the instrument parameters,
  1121.                 refer to offsets 24h - 33h of the Sound Blaster Instrument
  1122.                 file (SBI) format. The instrument parameters follow the same
  1123.                 order and definition as the SBI file.
  1124.  
  1125.         Entry:  The registers should be set as follows for entry to the
  1126.                 driver:
  1127.  
  1128.                 BX = 2 - function number (Set Instrument Table)
  1129.                 DX:AX - far pointer to the instrument table
  1130.                 CX - number of instruments defined in the table
  1131.  
  1132.         Exit:   No values are returned by the driver upon exit.
  1133.  
  1134.  
  1135. *   Set System Clock Rate (function 3) - This function informs the driver of
  1136.                                          the clock rate that the timer chip
  1137.                                          (channel 0) should return to after
  1138.                                          the music has finished. If this
  1139.                                          function is never called, then the
  1140.                                          driver will re-program the timer
  1141.                                          chip for the PC's standard value of
  1142.                                          18.2 Hz.
  1143.  
  1144.         Entry:  The registers should be set as follows for entry to the
  1145.                 driver:
  1146.  
  1147.                 BX = 3 - function number (Set System Clock Rate)
  1148.                 AX = clock rate divisor (1193180 / clock frequency in Hz)
  1149.  
  1150.         Exit:   No values are returned by the driver upon exit.
  1151.  
  1152.  
  1153. *   Set Music Clock Rate (function 4) - This function informs the driver of
  1154.                                         the clock rate which the timer chip
  1155.                 (channel 0) should be programmed for when the music output
  1156.                 is started (Play FM Music function). If this function is
  1157.                 never called then the driver will program the timer chip for
  1158.                 the default value of 96 Hz.  This value should be calculated
  1159.                 using the value found in the CMF file's offset location
  1160.                 0Ch - 0Dh. If you wish to change the speed of playback, you
  1161.                 may call this function with other values.
  1162.  
  1163.         Entry:  The registers should be set as follows for entry to the
  1164.                 driver:
  1165.  
  1166.                 BX = 4 - function number (Set Music Clock Rate)
  1167.                 AX = clock rate divisor (1193180 / clock frequency in Hz)
  1168.  
  1169.         Exit:   No values are returned by the driver upon exit.
  1170.  
  1171.  
  1172. *   Transpose Music (function 5) - This function allows transposition of the
  1173.                                    music. A positive value for the offset
  1174.                                    transposes the music to a higher key, and
  1175.                                    a negative value transposes it to a lower
  1176.                                    key.
  1177.  
  1178.         Entry:  The registers should be set as follows for entry to the
  1179.                 driver:
  1180.  
  1181.                 BX = 5 - function number (Transpose Music)
  1182.                 AX = Number of semitones to offset music by
  1183.  
  1184.         Exit:   No values are returned by the driver upon exit.
  1185.  
  1186.  
  1187. *   Play FM Music (function 6) - This function plays the music defined in
  1188.                                  the music block of the CMF file. When the
  1189.                                  music begins, the status byte is changed to
  1190.                                  FFh, the timer chip is programmed for the
  1191.                                  clock rate set in the Set Music Clock Rate
  1192.                                  function, and the driver intercepts the
  1193.                                  timer interrupt.  The music block pointer
  1194.                                  may be determined by using the value at
  1195.                                  offset 08 - 09 in the CMF file's header.
  1196.  
  1197.         Entry:  The registers should be set as follows for entry to the
  1198.                 driver:
  1199.  
  1200.                 BX = 6 - function number (Play FM Music)
  1201.                 DX:AX = far pointer to the CMF file's music block
  1202.  
  1203.         Exit:   No values are returned by the driver upon exit.
  1204.  
  1205.  
  1206. *   Stop FM Music (function 7) - This function stops the current music output.
  1207.                                  Calling this function also sets the status
  1208.                                  byte to 00h, reprograms the timer chip for
  1209.                                  the rate set in the Set System Clock Rate
  1210.                                  function, and restores the clock's original
  1211.                                  interrupt vector.
  1212.  
  1213.         Entry:  The registers should be set as follows for entry to the
  1214.                 driver:
  1215.  
  1216.                 BX = 7 - function number (Stop FM Music)
  1217.  
  1218.         Exit:   Upon exit from the driver, the following values will be
  1219.                 returned in the registers listed:
  1220.  
  1221.                 AX = 0 - function succeeded, 1 - error, no music was active.
  1222.  
  1223.  
  1224. *   Reset FM Driver (function 8) - This function turns off the FM chips and
  1225.                                    initializes the instrument table to the
  1226.                                    16 default instruments. If any music is
  1227.                                    active, your program must call the Stop
  1228.                                    FM Music function first.  This function
  1229.                                    should always be called before you exit
  1230.                                    your program.
  1231.  
  1232.         Entry:  The registers should be set as follows for entry to the
  1233.                 driver:
  1234.  
  1235.                 BX = 8 - function number (Reset FM Driver)
  1236.  
  1237.         Exit:   Upon exit from the driver, the following values will be
  1238.                 returned in the registers listed:
  1239.  
  1240.                 AX = 0 - if function succeeded, 1 - error, music still active.
  1241.  
  1242.  
  1243. *   Pause FM Music (function 9) - This function pauses the current music
  1244.                                   output. The music status byte is not
  1245.                                   affected by this function.
  1246.  
  1247.         Entry:  The registers should be set as follows for entry to the
  1248.                 driver:
  1249.  
  1250.                 BX = 9 - function number (Pause FM Music)
  1251.  
  1252.         Exit:   Upon exit from the driver, the following values will be
  1253.                 returned in the registers listed:
  1254.  
  1255.                 AX = 0 - function succeeded, 1 - error, no music was active
  1256.  
  1257.  
  1258. *   Resume FM Music (function 10) - This function resumes the previously
  1259.                                     paused music output.  The music status
  1260.                                     byte is not affected by this function.
  1261.  
  1262.         Entry:  The registers should be set as follows for entry to the
  1263.                 driver:
  1264.  
  1265.                 BX = 10 - function number (Resume FM Music)
  1266.  
  1267.         Exit:   Upon exit from the driver, the following values will be
  1268.                 returned in the registers listed:
  1269.  
  1270.                 AX = 0 - function succeeded, 1 - error, no music was paused
  1271.  
  1272.  
  1273. *   Set SYSEX Callback (function 10) - This function installs a callback
  1274.                                        function to handle System Exclusive
  1275.                 (SysEx) commands embedded in the music stream. Upon entry to
  1276.                 the callback function, registers ES:SI point to the next byte
  1277.                 in the music stream after the SysEx command (F0h). The
  1278.                 callback routine must preserve all the registers and return
  1279.                 to the caller via a far return (RETF). If you wish to disable
  1280.                 the callback function you must again call this function with
  1281.                 the pointer set to NULL (0000:0000).
  1282.  
  1283.                 Note: That the driver ignores SysEx commands and continues
  1284.                 with the music block after the end SysEx command (F7).
  1285.  
  1286.         Entry:  The registers should be set as follows for entry to the
  1287.                 driver:
  1288.  
  1289.                 BX = 11 - function number (Set SysEx Callback)
  1290.  
  1291.         Exit:   No values are returned by the driver upon exit.
  1292.  
  1293.  
  1294. ----------------------------------------------------------
  1295. ------Programming the MIDI Music Driver (SBMIDI.EXE)------
  1296. ----------------------------------------------------------
  1297.     SBMIDI is a TSR driver that will play MID files on the board's OPL3 FM
  1298. chip (SB Pro 2 or SB16 only) or the Wave Blaster if you own an SB16. To use
  1299. the driver you must first install it into memory, determine what interrupt
  1300. it was attached to, and make all calls to the driver via that interrupt.
  1301.  
  1302.  
  1303. Command Line Options for SBMIDI
  1304. -------------------------------
  1305.     Usage:  SBMIDI [/X] | [/Y] | [/U] | [/?]
  1306.  
  1307.     [/X]: /G - General MIDI.
  1308.           /E - Extended MIDI (default).
  1309.           /B - Basic MIDI.
  1310.     [/Y]: /1 - Sound Blaster FM Music Synthesizer (default).
  1311.           /2 - External Music Synthesizer.
  1312.           /3 - External Music Synthesizer (MPU-401 Interface if SB16).
  1313.     [/U]: Unload the driver.
  1314.     [/?]: Display this help message.
  1315.  
  1316.  
  1317. Locating SBMIDI
  1318. ---------------
  1319.         The SBMIDI functions are invoked by calling the interrupt that was
  1320.     defined when the TSR was loaded. When loading, SBMIDI will scan
  1321.     interrupts between 80h and BFh, choosing the first interrupt that is
  1322.     unused (0000:0000). SBMIDI can be identified by searching for the
  1323.     signature string "SBMIDI," located at offset 0 from the interrupt
  1324.     vector's segment (ISEG:0000h).
  1325.  
  1326.     This pseudocode illustrates how to locate SBMIDI:
  1327.  
  1328.     while not last interrupt and SBMIDI not found
  1329.     {
  1330.         get interrupt vector
  1331.         signature pointer = (interrupt vector's segment : 0000h)
  1332.         does signature = "SBMIDI"?
  1333.             SBMIDI = found
  1334.         else
  1335.             increment to next interrupt
  1336.     }
  1337.  
  1338.     Note: Function FindDvr() in file DRVRFUNC.C demonstrates this concept.
  1339.  
  1340.  
  1341. Playing a MID File
  1342. ------------------
  1343.     This pseudo code illustrates how to play a .MID file.
  1344.  
  1345.     If SBMIDI's entry interrupt is located
  1346.     {
  1347.         Call Get Driver Version
  1348.         If driver version is greater than or equal to version written for
  1349.         {
  1350.             Call Initialize SBMIDI Driver
  1351.             Call Set Status Address
  1352.             Save original status address
  1353.             Load MID file into a memory buffer
  1354.             Call Prepare MIDI File passing the address of the buffer
  1355.             If no errors from Prepare MIDI file function
  1356.             {
  1357.                 Call Play MIDI Music
  1358.                           .
  1359.                           .
  1360.                           .
  1361.                 Call Pause MIDI Music
  1362.                 Call Resume MIDI Music
  1363.                           .
  1364.                           .
  1365.                           .
  1366.                 Call Stop MIDI Music
  1367.                 Restore original status address
  1368.             }
  1369.         }
  1370.     }
  1371.  
  1372.  
  1373. SBMIDI Function Definitions
  1374. ---------------------------
  1375.         The SBMIDI driver is accessed via the INT call. All parameters are
  1376.     exchanged with the driver through registers. In general, the BX register
  1377.     contains the function number to invoke.  The return value may be found
  1378.     in the AX register if it is a byte or word, or in DX:AX if it is a
  1379.     double word (4 bytes).  Current status of the driver may be determined
  1380.     by reading the Status Word (see "Set Status Address").
  1381.  
  1382.         Status Word = 0000h   Music is not playing
  1383.         Status Word = FFFFh   Music is playing
  1384.  
  1385.         Except for the AX and DX, all registers are preserved including
  1386.         the CPU flag register.
  1387.  
  1388.  
  1389. *   Get Driver Version (function 0) - This function returns the driver's
  1390.                                       version number.
  1391.  
  1392.         Entry:  The registers should be set as follows for entry to the
  1393.                 driver:
  1394.  
  1395.                 BX = 0 - function number (Get Driver Version)
  1396.  
  1397.         Exit:   Upon exit from the driver, the following values will be
  1398.                 returned in the registers listed:
  1399.  
  1400.                 AH = Major version number
  1401.                 AL = Minor version number
  1402.  
  1403.  
  1404. *   Initialize SBMIDI Driver (function 1) - This function performs necessary
  1405.                                             initialization functions within
  1406.                                             the driver.
  1407.  
  1408.         Entry:  The registers should be set as follows for entry to the
  1409.                 driver:
  1410.  
  1411.                 BX = 1 - function number (Initialize SBMIDI driver)
  1412.  
  1413.         Exit:   No values are returned by the driver upon exit.
  1414.  
  1415.  
  1416. *       Set Channel Map (function 2) - This Function performs channel
  1417.                                        remapping. It may be used to re-route
  1418.                 channels defined in the MIDI file to other channels in the
  1419.                 driver.  MIDI files use, essentially, three different
  1420.                 mappings: Basic MIDI, Extended MIDI, and General MIDI. Each
  1421.                 uses a different set  of channels and a specific mapping for
  1422.                 the percussion channel.  Basic MIDI uses the last 4 channels
  1423.                 (13_16), with channel 16 being defined as the percussion
  1424.                 channel. Extended MIDI uses the first 10 channels (1_10),
  1425.                 with channel 10 being defined as the percussion channel.
  1426.                 Last, General MIDI uses all 16 channels, with channel 10
  1427.                 being defined as the percussion channel.  The channel array
  1428.                 passed to the driver provides the relationship between the
  1429.                 specified channel in the MIDI file and the actual channel
  1430.                 used by the driver. Each entry in the array is defined as
  1431.                 follows:
  1432.  
  1433.                 map[channel # in MIDI file - 1] = channel # to map to - 1
  1434.  
  1435.         Entry:  The registers should be set as follows for entry to the
  1436.                 driver:
  1437.  
  1438.                 BX = 2 - function number (Set Channel Map)
  1439.                 DX:AX = far pointer to 16-byte channel array
  1440.  
  1441.         Exit:   No values are returned by the driver upon exit.
  1442.  
  1443.  
  1444. *   Set Status Address (function 3) - This function provides SBMIDI with a
  1445.                                       variable to report the current status
  1446.                                       of the driver. Your application must
  1447.                                       set this value before preparing any
  1448.                                       MIDI file for playback, and it must
  1449.                                       restore the original value before
  1450.                                       exiting to DOS.
  1451.  
  1452.         Entry:  The registers should be set as follows for entry to the
  1453.                 driver:
  1454.  
  1455.                 BX = 3 - function number (Set Status Address)
  1456.                 DX:AX - far pointer to the MIDI status word (2 bytes)
  1457.  
  1458.         Exit:   Upon exit from the driver, the following values will be
  1459.                 returned in the registers listed:
  1460.  
  1461.                 DX:AX - far pointer to the previous MIDI status word (2 bytes)
  1462.  
  1463.  
  1464. *   Prepare MIDI File (function 4) - This function passes the MIDI file's
  1465.                                      buffer to the driver and performs some
  1466.                                      premanipulation of the MIDI data.
  1467.  
  1468.         Entry:  The registers should be set as follows for entry to the
  1469.                 driver:
  1470.  
  1471.                 BX = 4 - function number (Prepare MIDI file)
  1472.                 DX:AX = far pointer to the MIDI file's buffer
  1473.  
  1474.         Exit:   Upon exit from the driver, the following values will be
  1475.                 returned in the registers listed:
  1476.  
  1477.                 AX = Zero if successful. Nonzero if function failed
  1478.  
  1479.  
  1480. *   Play MIDI Music (function 5) - This function actually starts the music
  1481.                                    output.  Note that the status word will
  1482.                                    change to FFFFh after calling this
  1483.                                    function.
  1484.  
  1485.         Entry:  The registers should be set as follows for entry to the
  1486.                 driver:
  1487.  
  1488.                 BX = 5 - function number (Play MIDI Music)
  1489.  
  1490.         Exit:   No values are returned by the driver upon exit.
  1491.  
  1492.  
  1493. *   Stop MIDI Music (function 6) - This function stops the currently playing
  1494.                                    music.  Note that the status word will
  1495.                                    change to 0000h after calling this
  1496.                                    function.
  1497.  
  1498.         Entry:  The registers should be set as follows for entry to the
  1499.                 driver:
  1500.  
  1501.                 BX = 6 - function number (Stop MIDI Music)
  1502.  
  1503.         Exit:   No values are returned by the driver upon exit.
  1504.  
  1505.  
  1506. *   Pause MIDI Music (function 7) - This function pauses the currently
  1507.                                     playing music.  Note that the status word
  1508.                                     doesn't change after calling this
  1509.                                     function.
  1510.  
  1511.         Entry:  The registers should be set as follows for entry to the
  1512.                 driver:
  1513.  
  1514.                 BX = 7 - function number (Pause MIDI Music)
  1515.  
  1516.         Exit:   No values are returned by the driver upon exit.
  1517.  
  1518.  
  1519. *   Resume MIDI Music (function 8) - This function resumes playback of
  1520.                                      currently paused music.  Note that the
  1521.                                      status word doesn't change after calling
  1522.                                      this function.
  1523.  
  1524.         Entry:  The registers should be set as follows for entry to the
  1525.                 driver:
  1526.  
  1527.                 BX = 8 - function number (Resume MIDI Music)
  1528.  
  1529.         Exit:   No values are returned by the driver upon exit.
  1530.  
  1531.  
  1532. ---------------------------------------------------------
  1533. ------Programming the Auxiliary Driver (AUXDRV.EXE)------
  1534. ---------------------------------------------------------
  1535.     The Auxiliary driver is a loadable driver instead of a TSR.  A loadable
  1536. driver offers a better solution to the programmer, because its loading and
  1537. unloading is left to the application, not to the user.  This increases the
  1538. probability that the application using the driver will run the first time
  1539. the user executes it.
  1540.  
  1541.  
  1542. Loading the Driver
  1543. ------------------
  1544.         All mixer functions are accessed as offsets from the beginning of the
  1545.     segment where the driver was loaded. This requires that the driver be
  1546.     loaded at a segment boundary. Loading a driver at a segment boundary
  1547.     simply means that the starting address of the driver must have an offset
  1548.     of zero (SEG:0000).  If you are using DOS function calls to allocate
  1549.     memory, then this has already been done for you (Interrupt 21h, function
  1550.     48h).  If you wish to use C's malloc() or farmalloc() calls then you need
  1551.     to follow the following loading procedure.
  1552.  
  1553.     {
  1554.         Get driver size
  1555.         Allocate memory for the driver size + 16
  1556.         Save the pointer returned by malloc for freeing the memory later
  1557.         Divide the pointer's offset by 16 and add it to the pointer's segment
  1558.         Add one to the pointer's segment
  1559.         Set the pointer's offset to zero
  1560.         Open the driver file
  1561.         Read the driver into the new location calculated above
  1562.         Close the driver file
  1563.                   .
  1564.                   .
  1565.                   .
  1566.         Your program goes here
  1567.                   .
  1568.                   .
  1569.                   .
  1570.         Free the memory associated with the original malloc'ed pointer
  1571.     }
  1572.  
  1573.  
  1574. Controlling the Mixer
  1575. ---------------------
  1576.         This pseudo code outlines the functions available for the mixer as
  1577.     well as some necessary functions which must be called before using the
  1578.     control functions.
  1579.  
  1580.     {
  1581.         Load Auxiliary driver
  1582.         Call Get Driver Version
  1583.         If driver version is greater than or equal to version written for
  1584.         {
  1585.             Call Get Environment Settings (SB16 only)
  1586.                       or
  1587.             Call Set Base I/O Address
  1588.             Call Set Fade Status Word Address (necessary)
  1589.             Call Set Pan Status Word Address (necessary)
  1590.             Call Initialize Driver
  1591.                       .
  1592.                       .
  1593.                       .
  1594.             Call Get Source Volume
  1595.             Call Set Source Volume
  1596.             Call Get Gain (SB16 only)
  1597.             Call Set Gain (SB16 only)
  1598.             Call Get Tone (SB16 only)
  1599.             Call Set Tone (SB16 only)
  1600.             Call Get AGC (SB16 only)
  1601.             Call Set AGC (SB16 only)
  1602.             Call Get Mixer Switches (SB16 only)
  1603.             Call Set Mixer Switches (SB16 only)
  1604.                       .
  1605.                       .
  1606.                       .
  1607.             Call Terminate Driver
  1608.         }
  1609.     }
  1610.  
  1611.  
  1612. AUXDRV Function Definitions
  1613. ---------------------------
  1614.         The auxiliary driver controls the volume levels of the digital voice
  1615.     channel, the FM music synthesizer, the microphone, the line-in source,
  1616.     and the CD player. Additionally, if you own an SB16, you can also control
  1617.     the gain, the bass and treble tone controls, and the volume of the Wave
  1618.     Blaster if you have one.
  1619.  
  1620.  
  1621.     < Sources >
  1622.  
  1623.         0 = Master volume
  1624.         1 = Voice volume
  1625.         2 = FM / Wave Blaster (SB16 only) volume
  1626.         3 = CD volume
  1627.         4 = Line-in volume
  1628.         5 = Microphone volume
  1629.         6 = PC speaker volume (SB16 only)
  1630.  
  1631.  
  1632.     < Volume Values >
  1633.  
  1634.             Volume for all the sources is represented by values from 0 to 255.
  1635.         This means that if you are controlling a Sound Blaster Pro (the Pro
  1636.         has eight volume steps for all sources except the microphone) and you
  1637.         wish to change the volume by one step, you must change the driver's
  1638.         level by 32 (256 _ 8 = 32).  Since the SB16 has 32 levels, you need
  1639.         only change the driver's level by 8 (256 _ 32 = 8).
  1640.  
  1641.             Volume levels are always represented as a word.  The lower byte
  1642.         defines the right channel, and the higher byte defines the left
  1643.         channel.  If a mono source is selected, then the high byte should be
  1644.         set to zero.
  1645.  
  1646.             Left channel--high byte = 0 to 255
  1647.             Right channel--low byte = 0 to 255
  1648.  
  1649.  
  1650.     < Gain Values (SB16 only) >
  1651.  
  1652.             The gain values range from 0 to 3. Each setting represents a
  1653.         doubling of the sound's level. Zero represents the original signal's
  1654.         volume and 3 represents 8 times the original level
  1655.         (Volume = Volume * (2 raised to the "gain" power)).
  1656.  
  1657.             Gain values are also represented as a word.  As in the volume
  1658.         settings, the lower byte defines the right channel, and the higher
  1659.         byte represents the left channel.
  1660.  
  1661.  
  1662.     < Tone Values (SB16 only) >
  1663.  
  1664.             Tone values range from 0 to 255. Since the SB16 has 16 settings
  1665.         you need to change the driver's value by 16 (256 / 16 = 16) to change
  1666.         the tone by one step.  Tone values are also represented as a word.
  1667.         The lower byte defines the right channel and the higher byte defines
  1668.         the left channel.
  1669.  
  1670.  
  1671.     < Mixer Switches (SB16 only) >
  1672.  
  1673.             The mixer switches allow you to select the live "pass-through"
  1674.         sources as well as the recording sources for the left and right
  1675.         channels. These are referred to as the output and input switches,
  1676.         respectively.  Each channel is defined by one word (2 bytes).  The
  1677.         switches are defined as follows:
  1678.  
  1679.         D15...D8   D7   D6   D5   D4   D3   D2   D1   D0
  1680.          |....|    |    |    |    |    |    |    |    |
  1681.          |....|    |    |    |    |    |    |    |    +---> Microphone
  1682.          |....|    |    |    |    |    |    |    +--------> Microphone
  1683.          |....|    |    |    |    |    |    +-------------> CD Right
  1684.          |....|    |    |    |    |    +------------------> CD Left
  1685.          |....|    |    |    |    +-----------------------> Line-In Right
  1686.          |....|    |    |    +----------------------------> Line-In Left
  1687.          |....|    |    +---------------------------------> MIDI Right
  1688.          |....|    +--------------------------------------> MIDI Left
  1689.          |....|
  1690.          |....+-------------------------------------------> Not Used
  1691.          +------------------------------------------------> Not Used
  1692.  
  1693.         Note: Since the microphone is a mono source, both bits (D0 and D1)
  1694.               should be set.  When using the Sound Blaster Pro, only the
  1695.               Line-In, CD, and Microphone are applicable. Also, only one
  1696.               source may be used, and both channels of that source should
  1697.               be selected simultaneously.
  1698.  
  1699.  
  1700. *   Get Version Number (function 0) - Gets the version number of the auxiliary
  1701.                                       driver.
  1702.  
  1703.         Entry:  The registers should be set as follows for entry to the
  1704.                 driver:
  1705.  
  1706.                 BX = 0 - function number (Get Version Number)
  1707.  
  1708.         Exit:   Upon exit from the driver, the following values will be
  1709.                 returned in the registers listed:
  1710.  
  1711.                 AH = Major version number
  1712.                 AL = Minor version number
  1713.  
  1714.  
  1715. *   Set Base I/O Address (function 1) - This function identifies the card's
  1716.                                         location so the mixer chip may be
  1717.                                         accessed.
  1718.  
  1719.         Entry:  The registers should be set as follows for entry to the
  1720.                 driver:
  1721.  
  1722.                 BX = 1 - function number (Set Base I/O Address)
  1723.                 AX = Base I/O Address
  1724.  
  1725.         Exit:   No values are returned by the driver upon exit.
  1726.  
  1727.  
  1728. *   Set Address of Fade Status Word (function 2) - This function is used to
  1729.                                                    set up a fade status word
  1730.                 necessary for the driver to operate properly. The fade and
  1731.                 pan functions are considered advanced and too specialized to
  1732.                 be covered in this text.  This function must be called even
  1733.                 though the fade functions are not used.
  1734.  
  1735.         Entry:  The registers should be set as follows for entry to the
  1736.                 driver:
  1737.  
  1738.                 BX = 2 - function number (Set Address of Fade Status Word)
  1739.                 ES:DI = far pointer to the fade status word
  1740.  
  1741.         Exit:   No values are returned by the driver upon exit.
  1742.  
  1743.  
  1744. *   Set Address of Pan Status Word (function 3) - This function is used to
  1745.                                                   set up a pan status word
  1746.                 necessary for the driver to operate properly.  The fade and
  1747.                 pan functions are considered advanced and too specialized to
  1748.                 be covered in this text.  This function must be called even
  1749.                 though the pan functions are not used.
  1750.  
  1751.         Entry:  The registers should be set as follows for entry to the
  1752.                 driver:
  1753.  
  1754.                 BX = 3 - function number (Set Address of Pan Status Word)
  1755.                 ES:DI = far pointer to the pan status word
  1756.  
  1757.         Exit:   No values are returned by the driver upon exit.
  1758.  
  1759.  
  1760. *   Initialize Driver (function 4) - Performs some necessary initialization
  1761.                                      functions before the driver may be used.
  1762.  
  1763.         Entry:  The registers should be set as follows for entry to the
  1764.                 driver:
  1765.  
  1766.                 BX = 4 - function number (Initialize Driver)
  1767.  
  1768.         Exit:   No values are returned by the driver upon exit.
  1769.  
  1770.  
  1771. *   Terminate Driver (function 5) - Performs some necessary housekeeping
  1772.                                     functions before the application is
  1773.                                     terminated.
  1774.  
  1775.         Entry:  The registers should be set as follows for entry to the
  1776.                 driver:
  1777.  
  1778.                 BX = 5 - function number (Terminate Driver)
  1779.  
  1780.         Exit:   No values are returned by the driver upon exit.
  1781.  
  1782.  
  1783. *   Set Volume (function 6) - Sets the volume level of the specified source.
  1784.  
  1785.         Entry:  The registers should be set as follows for entry to the
  1786.                 driver:
  1787.  
  1788.                 BX = 6 - function number (Set Volume)
  1789.                 AX = Source (see "AUXDRV Function Definitions")
  1790.                 DX = Level (see "AUXDRV Function Definitions")
  1791.  
  1792.         Exit:   Upon exit from the driver, the following values will be
  1793.                 returned in the registers listed:
  1794.  
  1795.                 AX = Zero if successful. Nonzero if function failed
  1796.  
  1797.  
  1798. *   Get Volume (function 7) - Reads the volume level of the specified source.
  1799.  
  1800.         Entry:  The registers should be set as follows for entry to the
  1801.                 driver:
  1802.  
  1803.                 BX = 7 - function number (Get Volume)
  1804.                 AX = Source (see "AUXDRV Function Definitions")
  1805.  
  1806.         Exit:   Upon exit from the driver, the following values will be
  1807.                 returned in the registers listed:
  1808.  
  1809.                 AX = Level (see "AUXDRV Function Definitions")
  1810.  
  1811.  
  1812. *   Set Gain (function 21) - Sets the gain of the input or output stage.  Set
  1813.                              Gain is only available on the SB16.
  1814.  
  1815.         Entry:  The registers should be set as follows for entry to the
  1816.                 driver:
  1817.  
  1818.                 BX = 21 - function number (Set Gain)
  1819.                 AX = 0 - input stage, 1 - output stage
  1820.                 DX = Gain (see "AUXDRV Function Definitions")
  1821.  
  1822.         Exit:   Upon exit from the driver, the following values will be
  1823.                 returned in the registers listed:
  1824.  
  1825.                 AX = Zero if successful. Nonzero if function failed
  1826.  
  1827.  
  1828. *   Get Gain (function 22) - Reads the gain of either the input or the
  1829.                              output stage.  Get Gain is only available on
  1830.                              the SB16.
  1831.  
  1832.         Entry:  The registers should be set as follows for entry to the
  1833.                 driver:
  1834.  
  1835.                 BX = 22 - function number (Get Gain)
  1836.                 AX = 0 - input stage, 1 - output stage
  1837.  
  1838.         Exit:   Upon exit from the driver, the following values will be
  1839.                 returned in the registers listed:
  1840.  
  1841.                 AX = Gain (see "AUXDRV Function Definitions")
  1842.  
  1843.  
  1844. *   Set Tone (function 23) - Sets the treble or bass tone level.  Set Tone
  1845.                              is only available on the SB16.
  1846.  
  1847.         Entry:  The registers should be set as follows for entry to the
  1848.                 driver:
  1849.  
  1850.                 BX = 23 - function number (Set Tone)
  1851.                 AX = 0 - Treble, 1 - Bass
  1852.                 DX = Level (see "AUXDRV Function Definitions")
  1853.  
  1854.         Exit:   Upon exit from the driver, the following values will be
  1855.                 returned in the registers listed:
  1856.  
  1857.                 AX = Zero if successful. Nonzero if function failed
  1858.  
  1859. *   Get Tone (function 24) - Reads the treble or bass level.  Get Tone is
  1860.                              only available on the SB16.
  1861.  
  1862.         Entry:  The registers should be set as follows for entry to the
  1863.                 driver:
  1864.  
  1865.                 BX = 24 - function number (Get Tone)
  1866.                 AX = 0 - Treble, 1 - Bass
  1867.  
  1868.         Exit:   Upon exit from the driver, the following values will be
  1869.                 returned in the registers listed:
  1870.  
  1871.                 AX = Level (see "AUXDRV Function Definitions")
  1872.  
  1873.  
  1874. *   Set AGC (function 25) - This function will turn the AGC (Automatic Gain
  1875.                             Control) on or off.  Set AGC is only available on
  1876.                             the SB16.
  1877.  
  1878.         Entry:  The registers should be set as follows for entry to the
  1879.                 driver:
  1880.  
  1881.                 BX = 25 - function number (Set AGC)
  1882.                 AX = 0 - OFF, 1 - ON
  1883.  
  1884.         Exit:   Upon exit from the driver, the following values will be
  1885.                 returned in the registers listed:
  1886.  
  1887.                 AX = Zero if successful. Nonzero if function failed
  1888.  
  1889.  
  1890. *   Get AGC (function 26) - This function will read the AGC (Automatic Gain
  1891.                             Control) state.  Get AGC is only available on the
  1892.                             SB16.
  1893.  
  1894.         Entry:  The registers should be set as follows for entry to the
  1895.                 driver:
  1896.  
  1897.                 BX = 26 - function number (Get AGC)
  1898.  
  1899.         Exit:   Upon exit from the driver, the following values will be
  1900.                 returned in the registers listed:
  1901.  
  1902.                 AX = State (0 - OFF, 1 - ON)
  1903.  
  1904.  
  1905. *   Set Mixer Switches (function 27) - This function sets the input and
  1906.                                        output switches in the mixer.  Set
  1907.                                        Mixer Switches is only available on
  1908.                                        the SB16.
  1909.  
  1910.         Entry:  The registers should be set as follows for entry to the
  1911.                 driver:
  1912.  
  1913.                 BX = 27 - function number (Set Mixer Switches)
  1914.                 CX = 0 - input switches, 1 - output switches
  1915.                 DX = Left channel switches (see "AUXDRV Function Definitions")
  1916.                 AX = Right channel switches (see "AUXDRV Function Definitions")
  1917.  
  1918.         Exit:   Upon exit from the driver, the following values will be
  1919.                 returned in the registers listed:
  1920.  
  1921.                 AX = Zero if successful. Nonzero if function failed
  1922.  
  1923.  
  1924. *   Get Mixer Switches (function 28) - This function reads the input and
  1925.                                        output switches in the mixer.  Get
  1926.                                        Mixer Switches is only available on
  1927.                                        the SB16.
  1928.  
  1929.         Entry:  The registers should be set as follows for entry to the
  1930.                 driver:
  1931.  
  1932.                 BX = 28 - function number (Get Mixer Switches)
  1933.                 CX = 0 - input switches, 1 - output switches
  1934.  
  1935.         Exit:   Upon exit from the driver, the following values will be
  1936.                 returned in the registers listed:
  1937.  
  1938.                 DX = Left channel switches (see "AUXDRV Function Definitions")
  1939.                 AX = Right channel switches (see "AUXDRV Function Definitions")
  1940.  
  1941.  
  1942. *   Get Environment Settings (function 29) - This function parses the BLASTER
  1943.                                              environment string and sets the
  1944.                                              base I/O address variable in the
  1945.                                              driver.
  1946.  
  1947.         Entry:  The registers should be set as follows for entry to the
  1948.                 driver:
  1949.  
  1950.                 BX = 29 - function number (Get Environment Settings)
  1951.                 ES:DI = far pointer to the BLASTER environment string
  1952.  
  1953.         Exit:   Upon exit from the driver, the following values will be
  1954.                 returned in the registers listed:
  1955.  
  1956.                 AX = Zero if successful. Nonzero if function failed
  1957.  
  1958. ------------------------------------------------------------------------------
  1959. For more information on Creative Labs drivers, libraries, and low level
  1960. register information, contact Creative Labs Customer Service and ask for
  1961. the 2nd Edition of the DOS Developer's Kit.
  1962.  
  1963.  
  1964.